export interface IStore<State = any> {
  /**
   * 数据
   *
   * @author chitanda
   * @date 2021-04-04 19:04:37
   * @type {State}
   */
  readonly data: State;

  /**
   * 订阅事件
   *
   * @template K
   * @param {K} name
   * @param {(arg?: State[K]) => void} cb
   */
  on<K extends keyof State>(name: K, cb: (arg?: State[K]) => void): void;

  /**
   * 取消订阅事件
   *
   * @template K
   * @param {K} name
   * @param {(arg?: State[K]) => void} cb
   */
  off<K extends keyof State>(name: K, cb: (arg?: State[K]) => void): void;

  /**
   * 订阅store变化
   *
   * @param {(key: keyof State, val: State[keyof State]) => void} cb
   */
  onChange(cb: (key: keyof State, val: State[keyof State]) => void): void;

  /**
   * 取消订阅store变化
   *
   * @param {(key: keyof State, val: State[keyof State]) => void} cb
   */
  offChange(cb: (key: keyof State, val: State[keyof State]) => void): void;
}
